package marksys.free.com.marksys.ui.face.facebykomlin;

import android.content.Context;
import android.support.annotation.AttrRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.FrameLayout;

import marksys.free.com.marksys.R;
import marksys.free.com.marksys.ui.face.facebykomlin.callback.FaceDetectionCallBack;


public class FaceSurfaceView extends FrameLayout {


    public FaceSurfaceView(@NonNull Context context) {
        super(context);
        initData(context);
    }

    public FaceSurfaceView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        initData(context);
    }

    public FaceSurfaceView(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initData(context);
    }

    CameraSurfaceView surfaceView;

    void initData(@NonNull Context context) {
        LayoutInflater.from(context).inflate(R.layout.face_view, this);
        surfaceView = findViewById(R.id.surfaceView);
        FaceView faceView = findViewById(R.id.faceView);

        surfaceView.faceView = faceView;
    }

    public void setFaceDetectionCallBack(FaceDetectionCallBack faceDetectionCallBack) {

        if (surfaceView != null) {
            surfaceView.faceDetectionCallBack = faceDetectionCallBack;
        }
    }
}